package com.ruoyi.web.controller.teacher;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.domain.BasisAntenna;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.BasisAntennaType;
import com.ruoyi.service.IBasisAntennaTypeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 天线类型Controller
 * 
 * @author wangzebing
 * @date 2025-05-16
 */
@RestController
@RequestMapping("/type")
public class BasisAntennaTypeController extends BaseController
{
    @Autowired
    private IBasisAntennaTypeService basisAntennaTypeService;

    /**
     * 查询天线类型列表
     */
    @GetMapping("/list")
    public TableDataInfo list(BasisAntennaType basisAntennaType)
    {
        startPage();
        List<BasisAntennaType> list = basisAntennaTypeService.selectBasisAntennaTypeList(basisAntennaType);
        return getDataTable(list);
    }

    /**
     * 导出天线类型列表
     */
    @Log(title = "天线类型", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BasisAntennaType basisAntennaType)
    {
        List<BasisAntennaType> list = basisAntennaTypeService.selectBasisAntennaTypeList(basisAntennaType);
        ExcelUtil<BasisAntennaType> util = new ExcelUtil<BasisAntennaType>(BasisAntennaType.class);
        util.exportExcel(response, list, "天线类型数据");
    }

    /**
     * 获取天线类型详细信息
     */
    @GetMapping(value = "/{antennaTypeId}")
    public AjaxResult getInfo(@PathVariable("antennaTypeId") Long antennaTypeId)
    {
        return success(basisAntennaTypeService.selectBasisAntennaTypeByAntennaTypeId(antennaTypeId));
    }

    /**
     * 新增天线类型
     */
    @Log(title = "天线类型", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BasisAntennaType basisAntennaType)
    {
        basisAntennaType.setType("天线类型");
        return toAjax(basisAntennaTypeService.insertBasisAntennaType(basisAntennaType));
    }

    /**
     * 修改天线类型
     */
    @Log(title = "天线类型", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BasisAntennaType basisAntennaType)
    {
        return toAjax(basisAntennaTypeService.updateBasisAntennaType(basisAntennaType));
    }

    /**
     * 删除天线类型
     */
    @Log(title = "天线类型", businessType = BusinessType.DELETE)
	@DeleteMapping("/{antennaTypeIds}")
    public AjaxResult remove(@PathVariable Long[] antennaTypeIds)
    {
        return toAjax(basisAntennaTypeService.deleteBasisAntennaTypeByAntennaTypeIds(antennaTypeIds));
    }


    //配置天线类型
    @PostMapping("/configBasisAnteenType")
    public AjaxResult addBasisAntennaAntennaType(@RequestBody BasisAntennaType basisAntennaType)
    {
        return toAjax(basisAntennaTypeService.addBasisAntennaAntennaType(basisAntennaType));
    }
}
